<?php
	/* Functions in this file */
	/**************************/

	// Deserialize(&$stream)
	// DeserializeVersion1_7(&$stream)
	// GetFileType()
	// GetLessonAuthor()
	// GetLessonCopyright()
	// GetLessonLevel()
	// GetLessonMusicStyle()
	// GetLessonNotes()
	// GetLessonSubtitle()
	// GetLessonTitle()
	// GetSongArranger()
	// GetSongArtist()
	// GetSongAudioReleaseTitle()
	// GetSongAudioReleaseType()
	// GetSongAudioReleaseYear()
	// GetSongAuthorType()
	// GetSongBassScoreNotes()
	// GetSongBassScoreTranscriber()
	// GetSongBootlegDate()
	// GetSongBootlegTitle()
	// GetSongComposer()
	// GetSongContentType()
	// GetSongCopyright()
	// GetSongGuitarScoreNotes()
	// GetSongGuitarScoreTranscriber()
	// GetSongLyricist()
	// GetSongLyrics()
	// GetSongReleaseTitle()
	// GetSongReleaseType()
	// GetSongTitle()
	// GetSongVideoReleaseTitle()
	// GetVersion()
	// IsLesson()
	// IsSong()
	// IsSongAudioReleaseLive()
	// IsSongVideoReleaseLive()
	// IsValidAudioReleaseType($audioReleaseType)
	// IsValidAuthorType($authorType)
	// IsValidFileType($fileType)
	// IsValidFileVersion($version)
	// IsValidLessonLevel($level)
	// IsValidMusicStyle($musicStyle)
	// IsValidPowerTabFileMarker($marker)
	// IsValidSongContentType($contentType)
	// IsValidSongReleaseType($releaseType)
	// LoadDefaults()
	// PowerTabFileHeader()
	// SetFileType($fileType)
	// SetLesson()
	// SetLessonAuthor($author)
	// SetLessonCopyright($copyright)
	// SetLessonLevel($level)
	// SetLessonMusicStyle($musicStyle)
	// SetLessonNotes($notes)
	// SetLessonSubtitle($subtitle)
	// SetLessonTitle($title)
	// SetSong()
	// SetSongArranger($arranger)
	// SetSongArtist($artist)
	// SetSongAudioReleaseTitle($title)
	// SetSongAudioReleaseType($type)
	// SetSongAudioReleaseYear($year)
	// SetSongAuthorType($authorType)
	// SetSongBassScoreNotes($notes)
	// SetSongBassScoreTranscriber($transcriber)
	// SetSongBootlegDate(&$date)
	// SetSongBootlegTitle($title)
	// SetSongComposer($composer)
	// SetSongContentType($contentType)
	// SetSongCopyright($copyright)
	// SetSongGuitarScoreNotes($notes)
	// SetSongGuitarScoreTranscriber($transcriber)
	// SetSongLyricist($lyricist)
	// SetSongLyrics($lyrics)
	// SetSongReleaseType($releaseType)
	// SetSongTitle($title)
	// SetSongVideoReleaseTitle($title)
	// SetVersion($version)
?>
 
<?php
	 
	 
	class PowerTabFileHeader {
		 
		const POWERTABFILE_MARKER = 0x62617470;
		 
		const NUM_FILEVERSIONS = 4;
		const FILEVERSION_1_0 = 1;
		const FILEVERSION_1_0_2 = 2;
		const FILEVERSION_1_5 = 3;
		const FILEVERSION_1_7 = 4;
		const FILEVERSION_CURRENT = self::FILEVERSION_1_7;
		 
		const NUM_FILETYPES = 2;
		const FILETYPE_SONG = 0;
		const FILETYPE_LESSON = 1;
		 
		const CONTENTTYPE_NONE = 0;
		const CONTENTTYPE_GUITAR = 0x00000001;
		const CONTENTTYPE_BASS = 0x00000002;
		const CONTENTTYPE_PERCUSSION = 0x00000004;
		const CONTENTTYPE_ALL = 0x00000007;
		 
		const NUM_RELEASETYPES = 4;
		const RELEASETYPE_PUBLIC_AUDIO = 0;
		const RELEASETYPE_PUBLIC_VIDEO = 1;
		const RELEASETYPE_BOOTLEG = 2;
		const RELEASETYPE_NOTRELEASED = 3;
		 
		const NUM_AUDIORELEASETYPES = 6;
		const AUDIORELEASETYPE_SINGLE = 0;
		const AUDIORELEASETYPE_EP = 1;
		const AUDIORELEASETYPE_ALBUM = 2;
		const AUDIORELEASETYPE_DOUBLEALBUM = 3;
		const AUDIORELEASETYPE_TRIPLEALBUM = 4;
		const AUDIORELEASETYPE_BOXSET = 5;
		 
		const NUM_AUTHORTYPES = 2;
		const AUTHORTYPE_AUTHORKNOWN = 0;
		const AUTHORTYPE_TRADITIONAL = 1;
		 
		const NUM_MUSICSTYLES = 19;
		const MUSICSTYLE_ALTERNATIVE = 0;
		const MUSICSTYLE_BLUEGRASS = 1;
		const MUSICSTYLE_BLUES = 2;
		const MUSICSTYLE_COUNTRY = 3;
		const MUSICSTYLE_FINGERPICK = 4;
		const MUSICSTYLE_FLAMENCO = 5;
		const MUSICSTYLE_FOLK = 6;
		const MUSICSTYLE_FUNK = 7;
		const MUSICSTYLE_FUSION = 8;
		const MUSICSTYLE_GENERAL = 9;
		const MUSICSTYLE_JAZZ = 10;
		const MUSICSTYLE_METAL = 11;
		const MUSICSTYLE_OTHER = 12;
		const MUSICSTYLE_POP = 13;
		const MUSICSTYLE_PROGRESSIVE = 14;
		const MUSICSTYLE_PUNK = 15;
		const MUSICSTYLE_REGGAE = 16;
		const MUSICSTYLE_ROCK = 17;
		const MUSICSTYLE_SWING = 18;
		 
		const NUM_LESSONLEVELS = 3;
		const LESSONLEVEL_BEGINNER = 0;
		const LESSONLEVEL_INTERMEDIATE = 1;
		const LESSONLEVEL_ADVANCED = 2;
		 
		// Compatibility Constants (used by v1.0-v1.5 formats)
		const NUM_RELEASEDONS = 11;
		const RO_SINGLE = 0;
		const RO_EP = 1;
		const RO_LP = 2;
		const RO_DOUBLELP = 3;
		const RO_TRIPLELP = 4;
		const RO_BOXSET = 5;
		const RO_BOOTLEG = 6;
		const RO_DEMO = 7;
		const RO_SOUNDTRACK = 8;
		const RO_VIDEO = 9;
		const RO_NONE = 10;
		 
		 
		protected $m_version;
		protected $m_fileType;
		 
		// Song $type data
		protected $m_songData;
		 
		// Lesson $type data
		protected $m_lessonData;
		 
		 
		 
		// Header Functions
		 
		function IsValidPowerTabFileMarker($marker) {
			return ($marker == self::POWERTABFILE_MARKER);
		}
		 
		// Version Functions
		 
		 
		 
		function IsValidFileVersion($version) {
			return (($version >= self::FILEVERSION_1_0) && ($version <= self::FILEVERSION_CURRENT));
		}
		 
		 
		 
		function SetVersion($version) {
			if (!$this->IsValidFileVersion($version)) return 0;
			$this->m_version = $version;
			 return 1;
		}
		 
		 
		function GetVersion() {
			return ($this->m_version);
		}
		 
		// File Type Functions
		 
		 
		 
		function IsValidFileType($fileType) {
			return ($fileType < self::NUM_FILETYPES);
		}
		 
		 
		 
		function SetFileType($fileType) {
			if (!$this->IsValidFileType($fileType)) return 0;
			$this->m_fileType = $fileType;
			 return 1;
		}
		 
		 
		function GetFileType() {
			return ($this->m_fileType);
		}
		 
		function SetSong() {
			$this->SetFileType(self::FILETYPE_SONG);
		}
		 
		 
		function IsSong() {
			return ($this->GetFileType() == self::FILETYPE_SONG);
		}
		 
		function SetLesson() {
			$this->SetFileType(self::FILETYPE_LESSON);
		}
		 
		 
		function IsLesson() {
			return ($this->GetFileType() == self::FILETYPE_LESSON);
		}
		 
		// Song Functions
		 
		 
		 
		function IsValidSongContentType($contentType) {
			return ($contentType <= self::CONTENTTYPE_ALL);
		}
		 
		 
		 
		function SetSongContentType($contentType) {
			if (!$this->IsValidSongContentType($contentType)) return 0;
			$this->m_songData["contentType"] = $contentType;
			 return 1;
		}
		 
		 
		function GetSongContentType() {
			return ($this->m_songData["contentType"]);
		}
		 
		 
		 
		 
		function SetSongTitle($title) {
			if (!$title != NULL) return 0;
			$this->m_songData["title"] = $title;
			 return 1;
		}
		 
		 
		function GetSongTitle() {
			return ($this->m_songData["title"]);
		}
		 
		 
		 
		 
		function SetSongArtist($artist) {
			if (!$artist != NULL) return 0;
			$this->m_songData["artist"] = $artist;
			 return 1;
		}
		 
		 
		function GetSongArtist() {
			return ($this->m_songData["artist"]);
		}
		 
		 
		 
		 
		function IsValidSongReleaseType($releaseType) {
			return ($releaseType < self::NUM_RELEASETYPES);
		}
		 
		 
		 
		function SetSongReleaseType($releaseType) {
			if (!$this->IsValidSongReleaseType($releaseType)) return 0;
			$this->m_songData["releaseType"] = $releaseType;
			 return 1;
		}
		 
		 
		function GetSongReleaseType() {
			return ($this->m_songData["releaseType"]);
		}
		 
		 
		 
		function IsValidAudioReleaseType($audioReleaseType) {
			return ($audioReleaseType < self::NUM_AUDIORELEASETYPES);
		}
		 
		 
		 
		function SetSongAudioReleaseType($type) {
			if (!$this->IsValidAudioReleaseType($type)) return 0;
			$this->m_songData["audioData"]["type"] = $type;
			 return 1;
		}
		 
		 
		function GetSongAudioReleaseType() {
			return ($this->m_songData["audioData"]["type"]);
		}
		 
		 
		 
		 
		function SetSongAudioReleaseTitle($title) {
			if (!$title != NULL) return 0;
			$this->m_songData["audioData"]["title"] = $title;
			 return 1;
		}
		 
		 
		function GetSongAudioReleaseTitle() {
			return ($this->m_songData["audioData"]["title"]);
		}
		 
		 
		 
		function SetSongAudioReleaseYear($year) {
			$this->m_songData["audioData"]["year"] = $year;
		}
		 
		 
		function GetSongAudioReleaseYear() {
			return ($this->m_songData["audioData"]["year"]);
		}
		 
		 
		 
		function SetSongAudioReleaseLive($set = 1) {
			$this->m_songData["audioData"]["live"] = (($set) ? 1 : 0);
		}
		 
		 
		function IsSongAudioReleaseLive() {
			return (($this->m_songData["audioData"]["live"] == 1) ? true : false);
		}
		 
		 
		 
		 
		function SetSongVideoReleaseTitle($title) {
			if (!$title != NULL) return 0;
			$this->m_songData["videoData"]["title"] = $title;
			 return 1;
		}
		 
		 
		function GetSongVideoReleaseTitle() {
			return ($this->m_songData["videoData"]["title"]);
		}
		 
		 
		 
		function SetSongVideoReleaseLive($set = 1) {
			$this->m_songData["videoData"]["live"] = (($set) ? 1 : 0);
		}
		 
		 
		function IsSongVideoReleaseLive() {
			return (($this->m_songData["videoData"]["live"] == 1) ? true : false);
		}
		 
		 
		 
		 
		function SetSongBootlegTitle($title) {
			if (!$title != NULL) return 0;
			$this->m_songData["bootlegData"]["title"] = $title;
			 return 1;
		}
		 
		 
		function GetSongBootlegTitle() {
			return ($this->m_songData["bootlegData"]["title"]);
		}
		 
		 
		 
		function IsValidAuthorType($authorType) {
			return ($authorType < self::NUM_AUTHORTYPES);
		}
		 
		 
		 
		function SetSongAuthorType($authorType) {
			if (!$this->IsValidAuthorType($authorType)) return 0;
			$this->m_songData["authorType"] = $authorType;
			 return 1;
		}
		 
		 
		function GetSongAuthorType() {
			return ($this->m_songData["authorType"]);
		}
		 
		 
		 
		 
		function SetSongComposer($composer) {
			if (!$composer != NULL) return 0;
			$this->m_songData["authorData"]["composer"] = $composer;
			 return 1;
		}
		 
		 
		function GetSongComposer() {
			return ($this->m_songData["authorData"]["composer"]);
		}
		 
		 
		 
		 
		function SetSongLyricist($lyricist) {
			if (!$lyricist != NULL) return 0;
			$this->m_songData["authorData"]["lyricist"] = $lyricist;
			 return 1;
		}
		 
		 
		function GetSongLyricist() {
			return ($this->m_songData["authorData"]["lyricist"]);
		}
		 
		 
		 
		 
		function SetSongArranger($arranger) {
			if (!$arranger != NULL) return 0;
			$this->m_songData["arranger"] = $arranger;
			 return 1;
		}
		 
		 
		function GetSongArranger() {
			return ($this->m_songData["arranger"]);
		}
		 
		 
		 
		 
		function SetSongGuitarScoreTranscriber($transcriber) {
			if (!$transcriber != NULL) return 0;
			$this->m_songData["guitarScoreTranscriber"] = $transcriber;
			 return 1;
		}
		 
		 
		function GetSongGuitarScoreTranscriber() {
			return ($this->m_songData["guitarScoreTranscriber"]);
		}
		 
		 
		 
		 
		function SetSongBassScoreTranscriber($transcriber) {
			if (!$transcriber != NULL) return 0;
			$this->m_songData["bassScoreTranscriber"] = $transcriber;
			 return 1;
		}
		 
		 
		function GetSongBassScoreTranscriber() {
			return ($this->m_songData["bassScoreTranscriber"]);
		}
		 
		 
		 
		 
		function SetSongCopyright($copyright) {
			if (!$copyright != NULL) return 0;
			$this->m_songData["copyright"] = $copyright;
			 return 1;
		}
		 
		 
		function GetSongCopyright() {
			return ($this->m_songData["copyright"]);
		}
		 
		 
		 
		 
		function SetSongLyrics($lyrics) {
			if (!$lyrics != NULL) return 0;
			$this->m_songData["lyrics"] = $lyrics;
			 return 1;
		}
		 
		 
		function GetSongLyrics() {
			return ($this->m_songData["lyrics"]);
		}
		 
		 
		 
		 
		function SetSongGuitarScoreNotes($notes) {
			if (!$notes != NULL) return 0;
			$this->m_songData["guitarScoreNotes"] = $notes;
			 return 1;
		}
		 
		 
		function GetSongGuitarScoreNotes() {
			return ($this->m_songData["guitarScoreNotes"]);
		}
		 
		 
		 
		 
		function SetSongBassScoreNotes($notes) {
			if (!$notes != NULL) return 0;
			$this->m_songData["bassScoreNotes"] = $notes;
			 return 1;
		}
		 
		 
		function GetSongBassScoreNotes() {
			return ($this->m_songData["bassScoreNotes"]);
		}
		 
		// Lesson Functions
		 
		 
		 
		function SetLessonTitle($title) {
			if (!$title != NULL) return 0;
			$this->m_lessonData["title"] = $title;
			 return 1;
		}
		 
		 
		function GetLessonTitle() {
			return ($this->m_lessonData["title"]);
		}
		 
		 
		 
		 
		function SetLessonSubtitle($subtitle) {
			if (!$subtitle != NULL) return 0;
			$this->m_lessonData["subtitle"] = $subtitle;
			 return 1;
		}
		 
		 
		function GetLessonSubtitle() {
			return ($this->m_lessonData["subtitle"]);
		}
		 
		 
		 
		 
		function IsValidMusicStyle($musicStyle) {
			return ($musicStyle < self::NUM_MUSICSTYLES);
		}
		 
		 
		 
		function SetLessonMusicStyle($musicStyle) {
			if (!$this->IsValidMusicStyle($musicStyle)) return 0;
			$this->m_lessonData["musicStyle"] = $musicStyle;
			 return 1;
		}
		 
		 
		function GetLessonMusicStyle() {
			return ($this->m_lessonData["musicStyle"]);
		}
		 
		 
		 
		 
		function IsValidLessonLevel($level) {
			return ($level < self::NUM_LESSONLEVELS);
		}
		 
		 
		 
		function SetLessonLevel($level) {
			if (!$this->IsValidLessonLevel($level)) return 0;
			$this->m_lessonData["level"] = $level;
			 return 1;
		}
		 
		 
		function GetLessonLevel() {
			return ($this->m_lessonData["level"]);
		}
		 
		 
		 
		 
		function SetLessonAuthor($author) {
			if (!$author != NULL) return 0;
			$this->m_lessonData["author"] = $author;
			 return 1;
		}
		 
		 
		function GetLessonAuthor() {
			return ($this->m_lessonData["author"]);
		}
		 
		 
		 
		 
		function SetLessonNotes($notes) {
			if (!$notes != NULL) return 0;
			$this->m_lessonData["notes"] = $notes;
			 return 1;
		}
		 
		 
		function GetLessonNotes() {
			return ($this->m_lessonData["notes"]);
		}
		 
		 
		 
		 
		function SetLessonCopyright($copyright) {
			if (!$copyright != NULL) return 0;
			$this->m_lessonData["copyright"] = $copyright;
			 return 1;
		}
		 
		 
		function GetLessonCopyright() {
			return ($this->m_lessonData["copyright"]);
		}
		 
		 
		 
		// Constructor/Destructor
		 
		function PowerTabFileHeader() {
			 
			//------Last Checked------//
			// - Dec 4, 2004
			$this->LoadDefaults();
		}
		 
		 
		// Serialization Functions
		 
	
		function Serialize(&$stream){
		 
	
			WRITE_INTEGER ($stream,self::POWERTABFILE_MARKER);
			WRITE_WORD ($stream,self::FILEVERSION_CURRENT);
			WRITE_BYTE ($stream,$this->m_fileType);

		 
			// Song
			if ($this->IsSong()) {

				WRITE_BYTE ($stream,$this->m_songData["contentType"]);
				WRITE_CSTRING ($stream,$this->m_songData["title"]);
				WRITE_CSTRING ($stream,$this->m_songData["artist"]);
				WRITE_BYTE ($stream,$this->m_songData["releaseType"]);

				if ($this->m_songData["releaseType"] == self::RELEASETYPE_PUBLIC_AUDIO) {

					WRITE_BYTE ($stream,$this->m_songData["audioData"]["type"]);
					WRITE_CSTRING ($stream,$this->m_songData["audioData"]["title"]);
					WRITE_WORD ($stream,$this->m_songData["audioData"]["year"]);
					WRITE_BYTE ($stream,$this->m_songData["audioData"]["live"]);

				}
				else if ($this->m_songData["releaseType"] == self::RELEASETYPE_PUBLIC_VIDEO) {

					WRITE_CSTRING ($stream,$this->m_songData["videoData"]["title"]);
					WRITE_BYTE ($stream,$this->m_songData["videoData"]["live"]);

				}
				else if ($this->m_songData["releaseType"] == self::RELEASETYPE_BOOTLEG) {

					WRITE_CSTRING ($stream,$this->m_songData["bootlegData"]["title"]);
					WRITE_WORD ($stream,$this->m_songData["bootlegData"]["month"]);
					WRITE_WORD ($stream,$this->m_songData["bootlegData"]["day"]);
					WRITE_WORD ($stream,$this->m_songData["bootlegData"]["year"]);

				}

				WRITE_BYTE ($stream,$this->m_songData["authorType"]);


				if ($this->m_songData["authorType"] == self::AUTHORTYPE_AUTHORKNOWN) {

					WRITE_CSTRING ($stream,$this->m_songData["authorData"]["composer"]);
					WRITE_CSTRING ($stream,$this->m_songData["authorData"]["lyricist"]);

				}

				WRITE_CSTRING ($stream,$this->m_songData["arranger"]);
				WRITE_CSTRING ($stream,$this->m_songData["guitarScoreTranscriber"]);
				WRITE_CSTRING ($stream,$this->m_songData["bassScoreTranscriber"]);
				WRITE_CSTRING ($stream,$this->m_songData["copyright"]);
				WRITE_CSTRING ($stream,$this->m_songData["lyrics"]);
				WRITE_CSTRING ($stream,$this->m_songData["guitarScoreNotes"]);
				WRITE_CSTRING ($stream,$this->m_songData["bassScoreNotes"]);

			}
			// Lesson
			else if ($this->IsLesson()) {

				WRITE_CSTRING ($stream,$this->m_lessonData["title"]);
				WRITE_CSTRING ($stream,$this->m_lessonData["subtitle"]);

				WRITE_WORD ($stream,$this->m_lessonData["musicStyle"]);
				WRITE_BYTE ($stream,$this->m_lessonData["level"]);


				WRITE_CSTRING ($stream,$this->m_lessonData["author"]);
				WRITE_CSTRING ($stream,$this->m_lessonData["notes"]);
				WRITE_CSTRING ($stream,$this->m_lessonData["copyright"]);

			}
		 
			return 1;
		}
		
		 
		 
		function Deserialize(&$stream) {
			 
			//------Last Checked------//
			// - Dec 28, 2004
			 
			// Read the special Power Tab file $marker
			$marker = READ_INTEGER ($stream);
			 
			 
			if (!$this->IsValidPowerTabFileMarker($marker)) {
				return 0;
			}
			 
			// Read the file $version
			$this->m_version = READ_WORD ($stream);
			 
			 
			if (!$this->IsValidFileVersion($this->m_version)) {
				 
				return 0;
			}
			 
			// Based on the file $version, deserialize
			$returnValue = 0;
			 
			$returnValue = $this->DeserializeVersion1_7($stream);
			 
			return ($returnValue);
		}
		 
		 
		 
		 
		function DeserializeVersion1_7(&$stream) {
			 
			//------Last Checked------//
			// - Dec 29, 2004
			$this->m_fileType = READ_BYTE ($stream);
			 
			 
			if (!$this->IsValidFileType($this->m_fileType)) {
				return 0;
			}
			 
			if ($this->m_fileType == self::FILETYPE_SONG) {
				 
				$this->m_songData["contentType"] = READ_BYTE ($stream);
				 
				 
				$this->m_songData["title"] = READ_CSTRING ($stream);
				 
				 
				$this->m_songData["artist"] = READ_CSTRING ($stream);
				 
				 
				$this->m_songData["releaseType"] = READ_BYTE ($stream);
				 
				 
				// CASE: Public audio release
				if ($this->m_songData["releaseType"] == self::RELEASETYPE_PUBLIC_AUDIO) {
					 
					$this->m_songData["audioData"]["type"] = READ_BYTE ($stream);
					$this->m_songData["audioData"]["title"] = READ_CSTRING ($stream);
					$this->m_songData["audioData"]["year"] = READ_WORD ($stream);
					$this->m_songData["audioData"]["live"] = READ_BYTE ($stream);
					 
				}
				// CASE: Public video release
				else if ($this->m_songData["releaseType"] == self::RELEASETYPE_PUBLIC_VIDEO) {
					 
					$this->m_songData["videoData"]["title"] = READ_CSTRING ($stream);
					$this->m_songData["videoData"]["live"] = READ_BYTE ($stream);
					 
				}
				// CASE: Bootleg release
				else if ($this->m_songData["releaseType"] == self::RELEASETYPE_BOOTLEG) {
					 
					$this->m_songData["bootlegData"]["title"] = READ_CSTRING ($stream);
					$this->m_songData["bootlegData"]["month"] = READ_WORD ($stream);
					$this->m_songData["bootlegData"]["day"] = READ_WORD ($stream);
					$this->m_songData["bootlegData"]["year"] = READ_WORD ($stream);
					 
				}
				 
				$this->m_songData["authorType"] = READ_BYTE ($stream);
				 
				 
				// CASE: Author known
				if ($this->m_songData["authorType"] == self::AUTHORTYPE_AUTHORKNOWN) {
					 
					$this->m_songData["authorData"]["composer"] = READ_CSTRING ($stream);
					$this->m_songData["authorData"]["lyricist"] = READ_CSTRING ($stream);
					 
				}
				 
				$this->m_songData["arranger"] = READ_CSTRING ($stream);
				 
				$this->m_songData["guitarScoreTranscriber"] = READ_CSTRING ($stream);
				 
				$this->m_songData["bassScoreTranscriber"] = READ_CSTRING ($stream);
				 
				$this->m_songData["copyright"] = READ_CSTRING ($stream);
				 
				$this->m_songData["lyrics"] = READ_CSTRING ($stream);
				 
				$this->m_songData["guitarScoreNotes"] = READ_CSTRING ($stream);
				 
				$this->m_songData["bassScoreNotes"] = READ_CSTRING ($stream);
				 
			}
			// Lesson
			else if ($this->m_fileType == self::FILETYPE_LESSON) {
				 
				$this->m_lessonData["title"] = READ_CSTRING ($stream);
				 
				$this->m_lessonData["subtitle"] = READ_CSTRING ($stream);
				 
				$this->m_lessonData["musicStyle"] = READ_WORD ($stream);
				$this->m_lessonData["level"] = READ_BYTE ($stream);
				 
				$this->m_lessonData["author"] = READ_CSTRING ($stream);
				 
				$this->m_lessonData["notes"] = READ_CSTRING ($stream);
				 
				$this->m_lessonData["copyright"] = READ_CSTRING ($stream);
				 
			}
			 
			return 1;
		}
		 
		 
		function GetSongReleaseTitle() {
			 
			//------Last Checked------//
			// - Dec 28, 2004
			 
			$returnValue = "";
			 
			$releaseType = $this->GetSongReleaseType();
			 
			// Video release
			if ($releaseType == self::RELEASETYPE_PUBLIC_VIDEO)
				$returnValue = $this->GetSongVideoReleaseTitle();
			// Bootleg
			else if ($releaseType == self::RELEASETYPE_BOOTLEG)
			$returnValue = $this->GetSongBootlegTitle();
			// Audio release
			else
				$returnValue = $this->GetSongAudioReleaseTitle();
			 
			return ($returnValue);
		}
		 
		 
		 
		/*
		function SetSongBootlegDate(&$date){
		 
		//------Last Checked------//
		// - Dec 28, 2004
		if (!date.IsValid()) return 0;
		 
		$this->m_songData["bootlegData"]["month"] = date.GetMonth() + 1;     // wxDateTime month is zero based, so add 1
		$this->m_songData["bootlegData"]["day"] = date.GetDay();
		$this->m_songData["bootlegData"]["year"] = date.GetYear();
		 
		return 1;
		}
		 
		 
		 
		function GetSongBootlegDate(){
		 
		//------Last Checked------//
		// - Dec 28, 2004
		wxDateTime $returnValue;
		$returnValue.SetDay($this->m_songData["bootlegData"]["day"]);
		$returnValue.SetYear($this->m_songData["bootlegData"]["year"]);
		 
		switch ($this->m_songData["bootlegData"]["month"]) {
		 
		case 2:
		$returnValue.SetMonth(wxDateTime::Feb);
		break;
		case 3:
		$returnValue.SetMonth(wxDateTime::Mar);
		break;
		case 4:
		$returnValue.SetMonth(wxDateTime::Apr);
		break;
		case 5:
		$returnValue.SetMonth(wxDateTime::May);
		break;
		case 6:
		$returnValue.SetMonth(wxDateTime::Jun);
		break;
		case 7:
		$returnValue.SetMonth(wxDateTime::Jul);
		break;
		case 8:
		$returnValue.SetMonth(wxDateTime::Aug);
		break;
		case 9:
		$returnValue.SetMonth(wxDateTime::Sep);
		break;
		case 10:
		$returnValue.SetMonth(wxDateTime::Oct);
		break;
		case 11:
		$returnValue.SetMonth(wxDateTime::Nov);
		break;
		case 12:
		$returnValue.SetMonth(wxDateTime::Dec);
		break;
		default:
		$returnValue.SetMonth(wxDateTime::Jan);
		break;
		}
		 
		return ($returnValue);
		}
		*/
		// Operations
		 
		function LoadDefaults() {
			 
			//------Last Checked------//
			// - Dec 28, 2004
			$this->m_version = self::FILEVERSION_CURRENT;
			$this->m_fileType = self::FILETYPE_SONG;
			 
			// Load default song data
			$this->m_songData["contentType"] = 0;
			$this->m_songData["title"] = '';
			$this->m_songData["artist"] = '';
			$this->m_songData["releaseType"] = self::RELEASETYPE_PUBLIC_AUDIO;
			 
			$this->m_songData["audioData"]["type"] = self::AUDIORELEASETYPE_ALBUM;
			$this->m_songData["audioData"]["title"] = '';
			$this->m_songData["audioData"]["year"] = date("Y");
			$this->m_songData["audioData"]["live"] = 0;
			 
			$this->m_songData["videoData"]["title"] = '';
			$this->m_songData["videoData"]["live"] = 0;
			 
			$this->m_songData["bootlegData"]["title"] = '';
			$this->m_songData["bootlegData"]["month"] = date("m");
			$this->m_songData["bootlegData"]["day"] = date("d");
			$this->m_songData["bootlegData"]["year"] = date("Y");
			 
			$this->m_songData["authorType"] = self::AUTHORTYPE_AUTHORKNOWN;
			 
			$this->m_songData["authorData"]["composer"] = '';
			$this->m_songData["authorData"]["lyricist"] = '';
			 
			$this->m_songData["arranger"] = '';
			 
			$this->m_songData["guitarScoreTranscriber"] = '';
			$this->m_songData["bassScoreTranscriber"] = '';
			 
			$this->m_songData["copyright"] = '';
			 
			$this->m_songData["lyrics"] = '';
			 
			$this->m_songData["guitarScoreNotes"] = '';
			$this->m_songData["bassScoreNotes"] = '';
			 
			// Load default lesson data
			$this->m_lessonData["title"] = '';
			$this->m_lessonData["subtitle"] = '';
			$this->m_lessonData["musicStyle"] = self::MUSICSTYLE_GENERAL;
			$this->m_lessonData["level"] = self::LESSONLEVEL_INTERMEDIATE;
			$this->m_lessonData["author"] = '';
			$this->m_lessonData["notes"] = '';
			$this->m_lessonData["copyright"] = '';
		}
		 
		 
	}
	 
?>

